module.exports = {

	checkMongoIndex(indexArr, options) {
		return checkMongoIndex.call(this, indexArr, options)
	},

}

async function checkMongoIndex(indexArr, opts) {
	for (let i = 0; i < indexArr.length; i++) {
		let {
			col,
			index,
			options = {}
		} = indexArr[i]
		Object.assign(options, opts)
		let collection = await this.getCollection(col)
		let exists = await collection.indexExists(index)
		if (!exists) {
			await collection.createIndex(index, options)
		}
	}
}